package frame;

import java.awt.*;

/**
 * 表格布局
 */
public class GridLayoutTest {
    public static void main(String[] args) {

        Frame frame = new Frame("TestGridLayout");

        Button buton1 = new Button("buton1");
        Button buton2 = new Button("buton1");
        Button buton3 = new Button("buton1");
        Button buton4 = new Button("buton1");

        frame.setLayout(new GridLayout(3, 2));

        frame.add(buton1);
        frame.add(buton2);
        frame.add(buton3);
        frame.add(buton4);

        frame.pack();//java函数，自动布局
        frame.setVisible(true);
    }
}
